$(function() {
  var alipay_charge_url = localCache.getSessionItem('alipay_charge_url'), 
  cardpay_charge_url = localCache.getSessionItem('cardpay_charge_url'), 
  periphery_code = localCache.getSessionItem('periphery_code'), 
  cust_account = localCache.getSessionItem('periphery_account'), 
  cust_name = encodeURIComponent(localCache.getSessionItem('companyName')), 
  ccode=localCache.getSessionItem('company_code'),
  pcode=localCache.getSessionItem('product_code'),
  rcode=localCache.getSessionItem('region_code'),
  operator = localCache.getSessionItem('userId');
  $('#alipay').on(
      'click',
      function() {
        platFormUtils.getAskCode({
          periphery_code : periphery_code,
          api_code:'mbilepay'
        }, function(code) {
          if (code) {
            var url = alipay_charge_url+'?periphery_code='
                + periphery_code + '&ask_code=' + code + '&cust_account=' + cust_account
                + '&is_visible_cust_account=false&cust_name=' + cust_name + '&operator=' + operator;
                  window.open(url,'newwindow','top=0,left=0,location=no,menubar=no,resizable=no,status=no,toolbar=no,width=600,height=600');
          } 
        });
      });
  $('#card').on('click',function(){
    platFormUtils.getAskCode({  
      periphery_code : periphery_code,
      api_code:'cardpay'
    }, function(code) {
      if (code) {
        var url = cardpay_charge_url+'?&company_code='+ccode+'&product_code='+pcode+'&region_code='+rcode+'&periphery_code='
            + periphery_code + '&ask_code=' + code + '&cust_account=' + cust_account
            + '&is_visible_cust_account=false&cust_name=' + cust_name + '&operator=' + operator;
        window.open(url,'newwindow','top=0,left=0,location=no,menubar=no,resizable=no,status=no,toolbar=no,width=600,height=600');
      } 
    });
  });
  
	// 返回按钮事件
	$('#backStarting').on('click', function() {
		var hasCached = meetCache.hasMeetStorage();
		var index = hasCached ? 10 : 0;
		router(index, '', true);
	});  

});
